/**
 * 获取岗位详情
 * 
 * /general/internship/detail
 */

const Companies = require('../../../models/companys')
const $ = require('../../../utils/common')
const utils = require('../../../utils/index')


const get_detail = async function(req, res) {
   try{

       if (!req.query.company_id) {
           $.sendMessage(res, 1015, 'company_id')
           return
       }

       const sql_res = await Companies.findAndCountAll({
           where: {
               id: req.query.company_id,
           },
       })

       res.json({
           code: 200,
           message: 'success',
           data: sql_res
       })

       utils.create_a_log(req, '年度岗位', '浏览岗位详情')

   }
   catch(error) {
       $.log('error :', error)
       res.json({
           code: 0000,
           message: '抓到异常',
           error: 'error' + error
       })
       utils.create_a_log(req, '年度岗位', '浏览岗位详情', '失败')
   }
}

module.exports = get_detail